// 云函数入口文件
const cloud = require('wx-server-sdk')

cloud.init({
  env:'sudden-3gzfypks0b9196f8'
})

// 云函数入口函数
exports.main = async (event, context) => {
  const wxContext = cloud.getWXContext()
  const db = cloud.database()
  const today =  db.collection('subben_pay').aggregate()
  // .aggregate()
  // .end()
.project({
  _id:0,
  money:1,
  time:1,
  info:1,
  leibie:1,
  _openid:1
})
.end()
  let list = today.then((v)=>{
    this.setState({
      list: v.list
    })
    console.log('today',this.state.list)
  })
  // list = today
  console.log("list",list)
  let newtoday=new Date();
  let year=newtoday.getFullYear();
  let month=newtoday.getMonth()+1;
  let day=newtoday.getDate();
  let newday = year + '-' + month + '-' + day

  

  console.log(newtoday)
  return {
    event,
  }
}